package com.itheima.easyexceldemo.pojo;


import lombok.Data;

@Data
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    //封装成功响应不带参数的
    public static<T> Result<T> success(){
        Result<T> result = new Result<>();
        result.setCode(1);
        result.setMsg("success");
        return result;
    }
    //封装成功响应带参数的
    public static <T> Result<T> success(T data){
        Result<T> result = new Result<>();
        result.setData(data);
        result.setCode(1);
        result.setMsg("success");
        return result;
    }
//    封装失败响应
    public static<T> Result<T> error(String msg){
        Result<T> result = new Result<>();
        result.setCode(0);
        result.setMsg(msg);
        return result;
    }

}